/**
 *ZHU framework. Copyright 2007-, all rights reserved.
 *
 * $Id$
 * $Revision$
 * $Date$
 * $Author$
 */
package daily.entity;

import java.util.*;

import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Table;

import org.apache.openjpa.persistence.*;
import org.apache.openjpa.persistence.jdbc.*;

import zhu.framework.entity.*;

import com.google.common.collect.*;

import daily.entity.security.*;

/**
 * @author xiaopengzhu
 * 
 */
@Entity
@Table
public class StaffGroup extends AbstractEntityWithLongId {

	/**
	 * @return the index
	 */
	public Integer getIndex() {
		return index;
	}

	/**
	 * @param index
	 *            the index to set
	 */
	public void setIndex(final Integer index) {
		this.index = index;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(final String name) {
		this.name = name;
	}

	/**
	 * @return the staffs
	 */
	public SortedSet<Staff> getStaffs() {
		return staffs;
	}

	/**
	 * @param staffs
	 *            the staffs to set
	 */
	public void setStaffs(final SortedSet<Staff> staffs) {
		this.staffs = staffs;
	}

	/**
	 * @return the functionSecuritySettings
	 */
	public SortedSet<FunctionSecuritySetting> getFunctionSecuritySettings() {
		return functionSecuritySettings;
	}

	/**
	 * @param functionSecuritySettings
	 *            the functionSecuritySettings to set
	 */
	public void setFunctionSecuritySettings(final SortedSet<FunctionSecuritySetting> functionSecuritySettings) {
		this.functionSecuritySettings = functionSecuritySettings;
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private Integer index;

	private String name;

	@ManyToMany(fetch = FetchType.EAGER)
	private SortedSet<Staff> staffs = Sets.newTreeSet();

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@ElementJoinColumn(name = "staff_group_entityid")
	@ElementDependent
	private SortedSet<FunctionSecuritySetting> functionSecuritySettings = Sets.newTreeSet();
}
